Skip to content

Rustup support #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Rustup support #96

wants to merge 19 commits into from

Conversation

paulober
Copy link
Collaborator

@paulober paulober commented Oct 1, 2024

No description provided.

@paulober
Copy link
Collaborator Author

paulober commented Oct 1, 2024

Note to myself squash before merge

@will-v-pi
Copy link
Collaborator

Now that RP2350 support has been added to probe-rs (probe-rs/probe-rs#3005), I think we can simplify the rust integration to use the "Debugger for probe-rs" extension rather then Cortex-Debug for debugging rust code. This has full support for defmt, so should be easier to integrate.

@paulober
Copy link
Collaborator Author

paulober commented Feb 9, 2025

Now that RP2350 support has been added to probe-rs (probe-rs/probe-rs#3005), I think we can simplify the rust integration to use the "Debugger for probe-rs" extension rather then Cortex-Debug for debugging rust code. This has full support for defmt, so should be easier to integrate.

I'll look into it. Im currently very busy, but I may find some time in a few weeks.

@paulober
Copy link
Collaborator Author

@will-v-pi Just updated the generator to use probe-rs but I can't get the defmt rtt (on RP2350) working again.
Any idea what the old config was that worked?

@will-v-pi
Copy link
Collaborator

I think the config used by https://github.com/rp-rs/rp2040-project-template was working for me

@paulober
Copy link
Collaborator Author

I think the config used by https://github.com/rp-rs/rp2040-project-template was working for me

Also for the Pico 2?

@will-v-pi
Copy link
Collaborator

I think the config used by https://github.com/rp-rs/rp2040-project-template was working for me

Also for the Pico 2?

I haven’t tried, but my hope is that with the probe-rs support it should just be a case of changing the chip name in the config?

@paulober
Copy link
Collaborator Author

paulober commented Apr 1, 2025

@will-v-pi
The current version of this branch generates the config stuff for rp2350 but it doesn't work for me on macOS. I get pkg size could not be determined errors with the pico probe or it connected but no defmt.

It seems like the issue was the missing DEFMT_LOG flag.

Copy link
Collaborator

@will-v-pi will-v-pi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great, thanks! I've tested with RP2040 and RP2350, and the only big issue I've found is that RP2350 Risc-V debugging doesn't seem to work, with probe-rs throwing an error. Do you see an error too when doing that? If it's a prope-rs issue, then probably worth putting a note somewhere, so we don't get a bunch of bug reports?

Couple of thoughts:

  • We should remove the -f flag from the Run Project picotool command, as rust projects won't work with that unless you've added it manually
  • Now rp235x-hal is on crates.io, we can get rid of the submodule and just have rp235x-hal = { version = "0.3", features = ["rt", "critical-section-impl"] } etc in the Cargo.toml
  • My new Switch Build Type command isn't getting disabled, like the other CMake commands - probably just missed when rebasing?
  • The Debug Project button throws an error "Configuration 'rp2040-project' is missing in 'launch.json'" - I'm guessing that just needs a rename in the command?
  • Could we add a Reload Window prompt after switching chips? I've found the existing Restart prompt from rust-analyzer can take a while to restart, and if you click Compile during that time it can get into a broken state

Other than that, this is looking excellent!

Signed-off-by: paulober <[email protected]>
@paulober
Copy link
Collaborator Author

Note that in the current state first rust project creation with fresh rustup install will take very long.
TODO: Add better progress indication during that time.
TODO: check that all requirements are checked on rust project opening.

@will-v-pi
Copy link
Collaborator

Just wanted to note that I got an error when compiling a project, because I had an old Cargo version:

  The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.84.1 (66221abde 2024-11-19)).
  Consider trying a newer version of Cargo (this may require the nightly release).
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

The link in the error didn't help - the solution was to run rustup update to update the Cargo version

if (!rustupOk) {
void window
.showErrorMessage(
"Rustup is not installed. Please install it manually.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to restart VS Code after installing rustup to load the correct environment variables, so might be worth adding that to this message?

Suggested change
"Rustup is not installed. Please install it manually.",
"Rustup is not installed. Please install it manually and restart VS Code.",

@will-v-pi
Copy link
Collaborator

I'm hitting an error on a clean windows install where if I just use the automated rustup installer (rustup-init.exe), it doesn't install all the required MSVC stuff (it only install MSVC build tools, not the Windows 11 SDK), and then the extension throws an error when installing the flip-link crate that linker.exe is not found.

It might be good to filter for that specific flip-link error and instead of printing the generic failure message, direct users to https://rust-lang.github.io/rustup/installation/windows-msvc.html#manual-install to make sure their prerequisites are installed correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants